
import 'package:flutter/material.dart';
import 'package:xim/common/get_style_view.dart';
import 'package:xim/config/route_config.dart';
import 'new_friends_controller.dart';
import 'new_friends_style.dart';

/// 新朋友页面
class NewFriendsPage extends GetStyleControllerView<dynamic, NewFriendsController, NewFriendStyle>{

  NewFriendsPage({super.key});

  @override
  Widget buildView(BuildContext context, data) {
    return Scaffold(
      appBar: style.appBar,
      body: Container(
        color: style.bgColor.color,
        child: controller.friends.isEmpty ? addFriendHint: Column(
            children: controller
                .friends.map((e) => style.userRowItem(
                e,
                controller.selfUerInfo.account
            )).toList(),
        ),
      ),
    );
  }

  Widget get addFriendHint => Center(
    child: GestureDetector(
      onTap: Routers.toFriendAddPage,
      child: Text(
        "还没有好友，点击添加好友",
        style: TextStyle(color: style.weakTextColor.color),
      ),
    ),
  );

}